using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableNumberOfUnits
	{
		public const string Table = "NumberOfUnits";
		public const string NumberOfUnitsID = "NumberOfUnitsID";
		public const string NumberOfUnitsName = "NumberOfUnitsName";
	}
	
	[Serializable]
	public class BaseNumberOfUnits
		: IDbSessionEntity, IJsonClass
	{
		int m_NumberOfUnitsID;
		/// <summary>
        /// 数量单位表ID
        /// </summary>
        public int NumberOfUnitsID
        {
            get { return m_NumberOfUnitsID; }
            set { m_NumberOfUnitsID = value; }
        }
		
		string m_NumberOfUnitsName;
		/// <summary>
        /// 数量单位名称
        /// </summary>
        public string NumberOfUnitsName
        {
            get { return m_NumberOfUnitsName; }
            set { m_NumberOfUnitsName = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_NumberOfUnitsID = reader[TableNumberOfUnits.NumberOfUnitsID];
            m_NumberOfUnitsName = reader[TableNumberOfUnits.NumberOfUnitsName];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableNumberOfUnits.NumberOfUnitsID, PrimaryKeyType.Identity, NumberOfUnitsID);
			writer[TableNumberOfUnits.NumberOfUnitsName] = NumberOfUnitsName;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_NumberOfUnitsID = idd;
        }
		
		public string TableName
        {
            get { return TableNumberOfUnits.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_NumberOfUnitsID = hashToRead["NumberOfUnitsID"];
			 
             m_NumberOfUnitsName = hashToRead["NumberOfUnitsName"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["NumberOfUnitsID"] = NumberOfUnitsID;
			 
            hashToFill["NumberOfUnitsName"] = NumberOfUnitsName;
			 
        }

        #endregion
		
	}
}
